package com.lijie.ossservice.controller;


import com.lijie.ossservice.utils.AliOSSUtils;
import com.lijie.utilscommon.response.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api
@RestController
@CrossOrigin
@RequestMapping("/ossservice/upload")
public class FileController {

    @Autowired
    private AliOSSUtils aliOSSUtils;

    @ApiOperation(value = "上传图片文件")
    @PostMapping("/uploadImgFile")
    public Result uploadImgFile(MultipartFile file){
        String s = aliOSSUtils.upload(file);
        return Result.ok().data("url",s);
    }
}
